<template>
  <div class="smsMass-wrapper">
    <zsearch  v-loading="loading">
    <template #title>
      <span>短信群发</span>
    </template>
      <template #date>
        <el-date-picker
            class="date-6"
            type="daterange"
            v-model="date"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="YYYY-MM-DD HH:mm:ss"
            >
        </el-date-picker>
      </template>
      <template #btns>
        <el-button class="btn-1" @click="hanledSearch">查询</el-button>
      </template>
      <template #table>
        <ztable 
          :tableData='data' 
          :strucs='columns'
          :height="'100%'"
          :width="'240'"
          :isshowOperation="true"
        >
        <template #default="slotScope">
          <el-button type="text" class="operation" 
            @click="handleDetail(slotScope.rowData)"
            >查看</el-button>
          
        </template>
        </ztable>
      </template>
      <template #page>
        <zpage 
            :currentPage="current" 
            :total="total"
            :pageSize="size"
            @handleSizeChange="handleSizeChange" 
            @handleCurrentChange="handleCurrentChange"
        ></zpage>
      </template>
    </zsearch>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue';
import ztable from '@components/Table/index.vue'
import zpage from '@components/pagination/pagination.vue'
import zsearch from '@components/search/search.vue'

export default defineComponent({
  name: 'SmsMass',
  components: {
    ztable,
    zpage,
    zsearch,
  },
  setup() {
    const state = reactive({
      loading: false,
      date: '',
      data: [],
      columns: [
        {
           id: 529,
            name: "",
            viewName: "创建人",
            type: 208,
            groupId: 501,
            dataSource: "",
            hint: null,
            defaultValue: null,
            length: null,
            minValue: null,
            maxValue: null,
            rangx: null,
            must: 1,
            errorHit: "",
            value: "",
            orderNum: 1,
            show: 1,
            canUpdate: 0,
            companyId: 1,
            listView: 1,
            insertShow: 1,
            canShow: 1,
            fixed: null,
            idName: null
        },
        {
           id: 529,
            name: "",
            viewName: "创建时间",
            type: 208,
            groupId: 501,
            dataSource: "",
            hint: null,
            defaultValue: null,
            length: null,
            minValue: null,
            maxValue: null,
            rangx: null,
            must: 1,
            errorHit: "",
            value: "",
            orderNum: 1,
            show: 1,
            canUpdate: 0,
            companyId: 1,
            listView: 1,
            insertShow: 1,
            canShow: 1,
            fixed: null,
            idName: null
        },
        {
           id: 529,
            name: "",
            viewName: "短信模板",
            type: 208,
            groupId: 501,
            dataSource: "",
            hint: null,
            defaultValue: null,
            length: null,
            minValue: null,
            maxValue: null,
            rangx: null,
            must: 1,
            errorHit: "",
            value: "",
            orderNum: 1,
            show: 1,
            canUpdate: 0,
            companyId: 1,
            listView: 1,
            insertShow: 1,
            canShow: 1,
            fixed: null,
            idName: null
        },
        {
           id: 529,
            name: "",
            viewName: "群发数量",
            type: 208,
            groupId: 501,
            dataSource: "",
            hint: null,
            defaultValue: null,
            length: null,
            minValue: null,
            maxValue: null,
            rangx: null,
            must: 1,
            errorHit: "",
            value: "",
            orderNum: 1,
            show: 1,
            canUpdate: 0,
            companyId: 1,
            listView: 1,
            insertShow: 1,
            canShow: 1,
            fixed: null,
            idName: null
        },
        {
           id: 529,
            name: "",
            viewName: "发送状态",
            type: 208,
            groupId: 501,
            dataSource: "",
            hint: null,
            defaultValue: null,
            length: null,
            minValue: null,
            maxValue: null,
            rangx: null,
            must: 1,
            errorHit: "",
            value: "",
            orderNum: 1,
            show: 1,
            canUpdate: 0,
            companyId: 1,
            listView: 1,
            insertShow: 1,
            canShow: 1,
            fixed: null,
            idName: null
        },
        {
           id: 529,
            name: "",
            viewName: "发送时间",
            type: 208,
            groupId: 501,
            dataSource: "",
            hint: null,
            defaultValue: null,
            length: null,
            minValue: null,
            maxValue: null,
            rangx: null,
            must: 1,
            errorHit: "",
            value: "",
            orderNum: 1,
            show: 1,
            canUpdate: 0,
            companyId: 1,
            listView: 1,
            insertShow: 1,
            canShow: 1,
            fixed: null,
            idName: null
        },
      ],
      current: 1,
      total: 0,
      size: 10,

    })

    const hanledSearch = () => {
      console.log(state.date)
    }

    const handleSizeChange = () => {

    }

    const handleCurrentChange = () => {

    }

    const handleDetail = (rowData:any) => {
      console.log(rowData, '查看')
    }
    return {
      ...toRefs(state),
      hanledSearch,
      handleSizeChange,
      handleCurrentChange,
      handleDetail
    }
  }

})
</script>

<style scoped lang="scss">
.smsMass-wrapper {
  height: 100%;
}
</style>